package lt.marsrutai.mobile.android.activity.intent;

import lt.marsrutai.mobile.android.cache.UpdateCacheRequest;
import lt.marsrutai.mobile.android.service.impl.DataDownloadService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class DataDownloadServiceIntentHolder extends IntentHolder {

    private static final String UPDATE_CACHE_REQUEST = "updateCacheRequest";
    private static final String ACTION_START = "actionStart";

    public DataDownloadServiceIntentHolder(Activity sourceActivity) {
        super(sourceActivity, DataDownloadService.class);

        // Start action is default unless otherwise stated.
        setActionStart(true);
    }

    public DataDownloadServiceIntentHolder(Intent intent) {
        super(intent);
    }

    public DataDownloadServiceIntentHolder(Bundle bundle) {
        super(bundle);
    }

    public void setUpdateCacheRequest(UpdateCacheRequest updateCacheRequest) {
        intent.putExtra(UPDATE_CACHE_REQUEST, updateCacheRequest);
    }

    public UpdateCacheRequest getUpdateCacheRequest() {
        return (UpdateCacheRequest) intent.getExtras().get(UPDATE_CACHE_REQUEST);
    }

    public void setActionStart(boolean actionStart) {
        intent.putExtra(ACTION_START, actionStart);
    }

    public boolean getActionStart() {
        return intent.getExtras().getBoolean(ACTION_START);
    }
}
